
package results;

import objects.SensorNetwork;
import objects.Sensor;
import java.util.*;


/**
 * Give the number of sensor sleeping in the network
 * 
 * @author csamon
 * @created june 05, 2007 
 */

public class ProbeSleepingSensor extends ProbeSensorNetwork {

	/** Property name monitored by the probe */
	private static final String PROPERTY_NAME = "ProbeSleepingSensor";

	/** Probe description */
	private static final String PROBE_DESCRIPTION = "";
	

	/**
	 * 
	 * 
	 * @param t
	 * @param probeName probe name
	 */
	public ProbeSleepingSensor(SensorNetwork t,String probeName) {
		super(DEPL_LOOP, t,probeName);
		
	}

	/** 
	 * Get the kCoverDuration in percentage.
	 * 
	 * * @see Results.Probe#getValue()
	 */
	protected Object getValue() {
	    Vector<Sensor> sensorVect = ((SensorNetwork) _linkedStation).getSensorVect();
	    int nbSleeping = 0;
	    for(Sensor s : sensorVect){
		if(s.getSleepingState() && s.getBatteryLevel() > 0){
		    nbSleeping++;
		}
	    }
	    return new Integer(nbSleeping);
	}

	/**
	 * Get the property Name
	 * @return property name
	 * @see Results.Probe#getPropertyName()
	 */
	public String getPropertyName() {
		return PROPERTY_NAME;
	}

	/**
	 * Get the descitption of the probe
	 * @return probe description
	 * @see Results.Probe#getProbeDescription()
	 */
	public String getProbeDescription() {
		return PROBE_DESCRIPTION;
	}

	public static void main(String[] args) {
	}
}
